"""Creates Schema instances from first principles."""


def BootstrapMeta(cls):

  Schema_construct = cls.BootstrapConstruct('Schema', """
    primary            Attribute Schema                = <required>   : id;
    secondary          Attribute file                  = <empty>      : str;
    secondary          Attribute comment               = <empty>      : simple abbrevs List<#>;
    secondary          Attribute condef                = <empty>      : complex;
    secondary          Attribute config                = <empty>      : complex;
    secondary          Attribute scope                 = <empty>      : simple;
    """)

  Construct_construct = cls.BootstrapConstruct('Construct', """
    feature            Attribute presence              = concrete     : List|<concrete|abstract>;
    feature            Attribute level                 = inner        : List|<inner|top>;
    feature            Attribute padding               = pad_before   : List|<pad_none|pad_after|pad_before|pad_around>;
    primary            Attribute Construct             = <required>   : id;
    secondary          Attribute order                 = <empty>      : id-list;
    secondary          Attribute indent                = 2            : int;
    secondary          Attribute extends               = <empty>      : xid;
    secondary          Attribute metaclass             = <metaclass>  : str;
    secondary baselang Attribute associations          = <empty>      : word-list abbrevs List<assocs>;
    secondary baselang Attribute imports               = <empty>      : word-list abbrevs List<import>;
    secondary          Attribute comment               = <empty>      : simple;
    secondary          Attribute config                = <empty>      : complex;
    secondary          Attribute template              = <empty>      : simple;
    secondary          Attribute special               = <empty>      : complex;
    secondary baselang Attribute scope                 = <empty>      : complex;
    secondary          Attribute compile               = <empty>      : complex;
    secondary          Attribute run                   = <empty>      : complex;
    secondary          Attribute test                  = <empty>      : complex;
    """)

  Attribute_construct = cls.BootstrapConstruct('Attribute', """
    feature   Attribute parameter                      = noparam      : List|<noparam|multi|unique|baselang|multibaselang>;
    feature   Attribute kind                           = undef        : List|<undef|feature|primary|secondary>;
    feature   Attribute key                            = showkey      : List|<nokey|showkey|abbrevkey>;
    feature   Attribute value                          = showval      : List|<noval|userval|showval>;
    feature   Attribute padding                        = pad_none     : List|<pad_before|pad_after|pad_around|pad_none>;
    feature   Attribute priority                       = minor        : List|<critical|major|medium|minor>;
    primary   Attribute Attribute                      = <required>   : id;
    secondary Attribute default                        = <empty>      : str abbrevs List<=>;
    secondary Attribute type                           = <empty>      : str abbrevs List<:>;
    secondary Attribute children                       = <empty>      : word-list;
    secondary Attribute abbrevs                        = <empty>      : str abbrevs List<abbrev>;
    secondary Attribute indent                         = 0            : int;
    secondary Attribute implicit                       = <empty>      : str;
    secondary Attribute comment                        = <empty>      : simple;
    secondary Attribute scope                          = <empty>      : complex;
    """)

  File_construct = cls.BootstrapConstruct('File', """
    primary            Attribute File                  = <required>   : word;
    secondary          Attribute comment               = <empty>      : simple abbrevs List<#>;
    secondary          Attribute config                = <empty>      : complex;
    secondary          Attribute scope                 = <empty>      : complex;
    secondary          Attribute test                  = <empty>      : complex;
    """)

  return [
    Schema_construct, 
    Construct_construct, 
    Attribute_construct, 
    File_construct
  ]


def BootstrapOopl(cls):

  namespace_construct = cls.BootstrapConstruct('namespace', """
    minor    primary            Attribute namespace        = <required>   : id;

    minor    secondary baselang Attribute associations     = <empty>      : word-list abbrevs List<assocs>;
    major    secondary baselang Attribute imports          = <empty>      : word-list abbrevs List<import>;
    critical secondary baselang Attribute tests            = <undef>      : complex;
    critical secondary          Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    medium   secondary          Attribute config           = <empty>      : complex;
    critical secondary baselang Attribute scope            = <empty>      : complex;
    """)

  class_construct = cls.BootstrapConstruct('class', """
    minor    feature            Attribute location         = code         : List|<unittest|code>;
    minor    feature            Attribute position         = internal     : List|<internal|root|leaf>;
    minor    feature            Attribute span             = specific     : List|<specific|general>;
    medium   feature            Attribute visibility       = public       : List|<public|private>;
    minor    feature            Attribute uniqueness       = normal       : List|<normal|interned|singleton>;
    medium   feature            Attribute presence         = concrete     : List|<concrete|abstract>;

    minor    primary            Attribute class            = <required>   : id;

    critical secondary baselang Attribute extends          = meta.root.Object : str abbrevs List<:>;
    major    secondary baselang Attribute testparent       = meta.testing.TestCase     : str abbrevs List<::>;
    major    secondary baselang Attribute implements       = <empty>      : id-list;
    critical secondary baselang Attribute within           = <empty>      : id;
    minor    secondary baselang Attribute associations     = <empty>      : complex abbrevs List<assocs>;
    major    secondary baselang Attribute imports          = <empty>      : word-list abbrevs List<import>;
    minor    secondary baselang Attribute template         = <empty>      : simple;
    minor    secondary baselang Attribute run              = <undef>      : simple;
    critical secondary baselang Attribute tests            = <undef>      : complex;
    critical secondary baselang Attribute clinit           = <undef>      : simple;
    critical secondary          Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    medium   secondary          Attribute config           = <empty>      : complex;
    minor    secondary          Attribute flags            = <empty>      : complex;
    critical secondary baselang Attribute scope            = <empty>      : complex;
    """)

  field_construct = cls.BootstrapConstruct('field', """
    critical feature            Attribute select           = getsetref    : List|<raw|get|set|ref|getset|getref|setref|getsetref>;
    minor    feature            Attribute status           = required     : List|<required|optional>;
    minor    feature            Attribute span             = specific     : List|<specific|general>;
    critical feature            Attribute visibility       = pubget       : List|<pubget|public|protected|private|unsafe>;
    critical feature            Attribute level            = instance     : List|<instance|static|meta>;
    minor    feature            Attribute nature           = autoin       : List|<inline|autoin|separate>;
    medium   feature            Attribute mutability       = mutable      : List|<mutable|immutable|const>;

    minor    primary            Attribute field            = <required>   : id;

    critical secondary baselang Attribute type             = <required>   : type abbrevs List<:>;
    critical secondary baselang Attribute default          = <empty>      : str abbrevs List<=>;
    minor    secondary baselang Attribute init             = <empty>      : simple abbrevs List<:=>;
    minor    secondary          Attribute multiplicity     = 1            : str;
    minor    secondary baselang Attribute delegate         = <undef>      : id;
    minor    secondary          Attribute singular         = <empty>      : id;
    minor    secondary          Attribute prefix           = _meta_       : id;
    critical secondary          Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    medium   secondary          Attribute config           = <empty>      : complex;
    critical secondary          Attribute scope            = <empty>      : complex;
    """)

  method_construct = cls.BootstrapConstruct('method', """
    minor    feature            Attribute coverage         = covgen       : List|<limited|covgen>;
    medium   feature            Attribute presence         = concrete     : List|<concrete|abstract>;
    major    feature            Attribute visibility       = public       : List|<public|protected|private>;
    minor    feature            Attribute span             = specific     : List|<specific|general>;
    major    feature            Attribute level            = instance     : List|<instance|static|meta>;
    minor    feature            Attribute nature           = autoin       : List|<inline|autoin|separate>;
    minor    feature            Attribute mutability       = mutable      : List|<mutable|immutable|const>;
    minor    feature            Attribute kind             = override     : List|<final|override>;
    minor    feature            Attribute dispatch         = autodispatch : List|<autodispatch|nonvirtual|virtual>;
    minor    feature            Attribute inheritance      = no_extend    : List|<no_extend|pre_extend|post_extend|super_extend|sub_extend>;

    minor    primary            Attribute method           = <required>   : id;

    critical secondary baselang Attribute params           = <required>   : complex;
    major    secondary baselang Attribute pargs            = <undef>      : str;
    critical secondary baselang Attribute returns          = void         : type abbrevs List<:>;
    critical secondary baselang Attribute returns_         = <empty>      : simple abbrevs List<:#>;
    major    secondary baselang Attribute throws           = <empty>      : str;
    minor    secondary          Attribute requires         = <empty>      : word-list;
    minor    secondary          Attribute pre              = <empty>      : complex;
    minor    secondary          Attribute post             = <empty>      : complex;
    minor    secondary baselang Attribute delegate         = <undef>      : id;
    critical secondary          Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    major    secondary          Attribute config           = <empty>      : complex;
    major    secondary baselang Attribute test             = <empty>      : simple;
    critical secondary baselang Attribute scope            = <empty>      : simple;
    minor    secondary baselang Attribute mock             = <undef>      : simple;
    """)

  initializer_construct = cls.BootstrapConstruct('initializer', """
    minor    feature            Attribute coverage         = covgen       : List|<limited|covgen>;
    major    feature            Attribute visibility       = public       : List|<public|protected|private>;
    minor    feature            Attribute span             = specific     : List|<specific|general>;
    minor    feature            Attribute nature           = autoin       : List|<inline|autoin|separate>;
    minor    feature            Attribute inheritance      = no_extend    : List|<no_extend|pre_extend|post_extend|super_extend|sub_extend>;

    minor    primary            Attribute initializer      = <assigned>   : id abbrevs List<init>;

    minor    secondary baselang Attribute preinit          = <empty>      : word;
    critical secondary baselang Attribute params           = <required>   : complex;
    major    secondary baselang Attribute pargs            = <undef>      : str;
    major    secondary baselang Attribute throws           = <empty>      : str;
    minor    secondary          Attribute pre              = <empty>      : complex;
    minor    secondary          Attribute post             = <empty>      : complex;
    critical secondary          Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    major    secondary          Attribute config           = <empty>      : complex;
    major    secondary baselang Attribute test             = <empty>      : simple;
    critical secondary baselang Attribute scope            = <empty>      : simple;
    """)

  var_construct = cls.BootstrapConstruct('var', """
    minor    feature            Attribute kind             = k_normal     : List|<vararg|k_normal>;
    minor    primary            Attribute var              = <required>   : id;
    critical secondary baselang Attribute type             = void         : type abbrevs List<:>;
    critical secondary baselang Attribute default          = <empty>      : str abbrevs List<=>;
    critical secondary baselang Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    """)

  native_construct = cls.BootstrapConstruct('native', """
    minor    feature            Attribute position         = defn         : List|<defn|decl|pre_decl|post_decl>;
    minor    feature            Attribute location         = code         : List|<unittest|code>;
    minor    primary            Attribute native           = <assigned>   : id;
    critical secondary baselang Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    critical secondary baselang Attribute scope            = <empty>      : simple;
    """)

  accessor_construct = cls.BootstrapConstruct('accessor', """
    minor    primary            Attribute accessor         = <required>   : id;

    critical secondary          Attribute comment          = <empty>      : simple abbrevs List|<#|rem>;
    major    secondary baselang Attribute test             = <empty>      : simple;
    critical secondary          Attribute scope            = <empty>      : simple;
    """)

  assoc_construct = cls.BootstrapConstruct('assoc', """
    minor    feature   Attribute kind     = cls        : List|<cls|lib|stdlib>;
    minor    feature   Attribute location = code       : List|<unittest|code|codetest>;
    minor    primary   Attribute assoc    = <required> : word;

    critical secondary Attribute limit    = <empty>    : word;
    critical secondary Attribute comment  = <empty>    : simple abbrevs List|<#|rem>;
    critical secondary Attribute scope    = <empty>    : simple;
    """)

  return [
    namespace_construct, 
    class_construct, 
    field_construct, 
    method_construct, 
    initializer_construct, 
    var_construct, 
    native_construct, 
    accessor_construct, 
    assoc_construct
  ]
